/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jeff.springWebTestNG.persistence.service;

import com.mongodb.BasicDBObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import org.springframework.stereotype.Service;

/**
 *
 * @author Jeff
 */
@Service
public class MongoDummyColPersister extends BaseMongoPersister implements IMongoDummyColPersister {

    public MongoDummyColPersister() {
        defaultColl = db.getCollection("dummyCol");
    }

    
    @Override
    public List<String> getAllColNames() {
        Set<String> nameSet = db.getCollectionNames();
        LOG.log(Level.INFO, "****** DB ACCESSED");
        List<String> ret = new ArrayList<String>(nameSet);
        return ret;
    }
    
    @Override
    public void addBasicDoc(BasicDBObject doc) {
        defaultColl.insert(doc);
    }
    
    @Override
    public BasicDBObject findOneDoc(BasicDBObject cond) {
        return (BasicDBObject) defaultColl.findOne(cond);
    }
    
}
